#include "wt588f_api.h"
#include "wt588f_app.h"
#include "wt588f_list.h"
#include "wt588f_board.h"

#if _VOICE_PLAY_TYPE_ == _VOICE_PLAY_SPEAKER_
/**
 * @brief 初始化消息队列
 *
 */
static void Wt588fInitialisingMessagequeue(void);

/**
 * @brief 启动语音播放
 *
 * @param pAudioFileTable - 音频文件表
 */
static void Wt588fStartVoicePaly(AudioFileTable_t *pAudioFileTable);

/**
 * @brief 获取音频文件
 *
 * @return AudioListNode_t - 存在着返回对应音频表，不存在则返回NULL
 */
static AudioListNode_t Wt588fGetVoiceFile(void);

/**
 * @brief 删除一个音频文件
 *
 * @param Node - 对应音频表
 */
static void Wt588fDelteVoiceFile(AudioListNode_t Node);

/**
 * @brief 设置音量等级
 *
 */
static void Wt588fSetVolumeLevel(void);

/**
 * @brief 音频播放任务回调
 *
 */
static void Wt588fPlayAudioTaskCallback(void);

static Wt588fStatusBit_t Wt588fStatusBit = {0};
static AudioListNode_t AudioHeadNode = NULL, FileListNode = NULL;

static void Wt588fInitialisingMessagequeue(void)
{
  AudioHeadNode = AudioListCreate();
}

static void Wt588fStartVoicePaly(AudioFileTable_t *pAudioFileTable)
{
  if (pAudioFileTable != NULL)
  {
    AudioListPushFront(AudioHeadNode, pAudioFileTable);

    if (Wt588fGetBusyStatus() != true)
    {
      Wt588fStatusBit.Step = VOICE_PLAY_INIT;

      Wt588fSetBusyStatus(true);
      Wt588fStartAudioPlaybackNoWait();
    }
  }
}

static AudioListNode_t Wt588fGetVoiceFile(void)
{
  AudioListNode_t MixListNode = NULL;
  AudioListNode_t TmpListNode = AudioHeadNode->NextItem;

  if (TmpListNode != AudioHeadNode)
  {
    MixListNode = TmpListNode;

    while (TmpListNode != AudioHeadNode)
    {
      if (MixListNode->FileTable.TriggerTime > TmpListNode->FileTable.TriggerTime)
      {
        MixListNode = TmpListNode;
      }

      TmpListNode = TmpListNode->NextItem;
    }
  }

  return MixListNode;
}

static void Wt588fDelteVoiceFile(AudioListNode_t Node)
{
  AudioListErase(Node);
}

static void Wt588fSetVolumeLevel(void)
{
  uint8_t DataSize = 0, DataBuff[AUDIO_FILE_DATA_SIZE] = {0};

  uint8_t VolumeLevel = Wt588fGetVolumeLevel();
  if (Wt588fGetDoNotDisturbFlag() == true)
  {
    VolumeLevel = WT588F_MIN_VOLUME_LEVEL;
  }

  Wt588fBuildSetVolumeLevelMessage(DataBuff, &DataSize, VolumeLevel);
  Wt588fSendDataBuff(DataBuff, DataSize);
}

static void Wt588fPlayAudioTaskCallback(void)
{
  switch (Wt588fStatusBit.Step)
  {
  case VOICE_PLAY_INIT:
  {
    Wt588fStatusBit.Step = VOICE_SET_VOLUME;

    Wt588fSetDataPinLevel(true);
    Wt588fSetPowerContorlPinLevel(true);
    Wt588fDelayedStartAudioPlaybackTask(WT588F_WAIT_LEVEL_STABILIZATION_TIME);
  }
  break;

  case VOICE_SET_VOLUME:
  {
    Wt588fSetVolumeLevel();

    Wt588fStatusBit.Step = VOICE_PLAY_GET_FILE;
    Wt588fStartAudioPlaybackNoWait();
  }
  break;

  case VOICE_PLAY_GET_FILE:
  {
    FileListNode = Wt588fGetVoiceFile();
    if (FileListNode != NULL)
    {
      Wt588fStatusBit.Step = VOICE_PLAY_AUDIO;
      Wt588fStartAudioPlaybackNoWait();
    }
    else
    {
      Wt588fStatusBit.Step = VOICE_PLAY_INIT;

      Wt588fSetBusyStatus(false);
      Wt588fSetDataPinLevel(false);
      Wt588fSetPowerContorlPinLevel(false);
    }
  }
  break;

  case VOICE_PLAY_AUDIO:
  {
    Wt588fSendDataBuff(FileListNode->FileTable.FilePacket, FileListNode->FileTable.SizeOfFile);

    Wt588fStatusBit.Step = VOICE_PLAY_WAIT_FINSH;
    Wt588fDelayedStartAudioPlaybackTask(WT588F_PLAYBACK_INTERVAL);
  }
  break;

  case VOICE_PLAY_WAIT_FINSH:
  {
    if (Wt588fGetBusyPinLevel() != true)
    {
      Wt588fStatusBit.Step = VOICE_PLAY_GET_FILE;
      Wt588fDelteVoiceFile(FileListNode);
    }
    else
    {
      Wt588fStatusBit.AccumulatedTimeOfDeviceBusy++;
      if (Wt588fStatusBit.AccumulatedTimeOfDeviceBusy >= WT588F_PLAYBACK_TIMEOUT)
      {
        Wt588fStatusBit.Step = VOICE_PLAY_INIT;
        Wt588fStatusBit.AccumulatedTimeOfDeviceBusy = 0;

        Wt588fDeleteAllAudioFile();
        Wt588fSetBusyStatus(false);
        Wt588fSetDataPinLevel(false);
        Wt588fSetPowerContorlPinLevel(false);
      }
    }

    Wt588fDelayedStartAudioPlaybackTask(WT588F_PLAYBACK_INTERVAL);
  }
  break;

  default:
    break;
  }
}

void Wt588fDeleteAllAudioFile(void)
{
  AudioListNode_t FileListNode = NULL;

  Wt588fSetBusyStatus(false);
  Wt588fStopAudioPlaybackTask();
  Wt588fSendOneByte(WT588F_STOP_PLAYING);
  Wt588fStatusBit.Step = VOICE_PLAY_IDLE;

  while ((FileListNode = Wt588fGetVoiceFile()) != NULL)
  {
    Wt588fDelteVoiceFile(FileListNode);
  }
}

void Wt588fPlayStartupAudio(void)
{
  AudioFileTable_t StartupAudio = {0};

  StartupAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildStartupToneMessage(StartupAudio.FilePacket, &StartupAudio.SizeOfFile);
  Wt588fStartVoicePaly(&StartupAudio);
}

void Wt588fPlayKeypadToneAudio(void)
{
  AudioFileTable_t KeypadToneAudio = {0};

  KeypadToneAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildKeyMessage(KeypadToneAudio.FilePacket, &KeypadToneAudio.SizeOfFile);
  Wt588fStartVoicePaly(&KeypadToneAudio);
}

void Wt588fPlayAlarmAudio(void)
{
  AudioFileTable_t AlarmAudio = {0};

  AlarmAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildAlarmMessage(AlarmAudio.FilePacket, &AlarmAudio.SizeOfFile);
  Wt588fStartVoicePaly(&AlarmAudio);
}

void Wt588fPlayDoorbellAudio(void)
{
  AudioFileTable_t DoorbellAudio = {0};

  DoorbellAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildDoorbellMessage(DoorbellAudio.FilePacket, &DoorbellAudio.SizeOfFile);
  Wt588fStartVoicePaly(&DoorbellAudio);
}

void Wt588fPlaySwitchFaceAuthenticationMode(void)
{
  AudioFileTable_t SwitchModeAudio = {0};

  SwitchModeAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildSwitchFaceAuthenticationModeMessage(SwitchModeAudio.FilePacket, &SwitchModeAudio.SizeOfFile);
  Wt588fStartVoicePaly(&SwitchModeAudio);
}

void Wt588fPlaySwitchQrcodeAuthenticationModeAudio(void)
{
  AudioFileTable_t SwitchModeAudio = {0};

  SwitchModeAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildSwitchQrcodeAuthenticationModeMessage(SwitchModeAudio.FilePacket, &SwitchModeAudio.SizeOfFile);
  Wt588fStartVoicePaly(&SwitchModeAudio);
}

void Wt588fPlaySettingStatusAudio(bool Status)
{
  AudioFileTable_t SetAudio = {0};

  SetAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildSettingStatusMessage(SetAudio.FilePacket, &SetAudio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&SetAudio);
}

void Wt588fPlayVerificationStatusAudio(bool Status)
{
  AudioFileTable_t SetAudio = {0};

  SetAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildVerificationStateMessage(SetAudio.FilePacket, &SetAudio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&SetAudio);
}

void Wt588fPlayDeviceDiscoverStatusAudio(bool Status)
{
  AudioFileTable_t DiscoverStatusAudio = {0};

  DiscoverStatusAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildDeviceDiscoverStatusMessage(DiscoverStatusAudio.FilePacket, &DiscoverStatusAudio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&DiscoverStatusAudio);
}

void Wt588fPlayFactoryResetStatusAudio(bool Status)
{
  AudioFileTable_t FactoryResetStatusAudio = {0};

  FactoryResetStatusAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildFactoryResetStatusMessage(FactoryResetStatusAudio.FilePacket, &FactoryResetStatusAudio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&FactoryResetStatusAudio);
}

void Wt588fPlayPermissionDeniedAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildPermissionDeniedMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayEquipmentBusyStatusAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildEquipmentBusyStatusMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayCurrentLockStatusAudio(bool Status)
{
  AudioFileTable_t LockStatusAudio = {0};

  LockStatusAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildCurrentLockStatusMessage(LockStatusAudio.FilePacket, &LockStatusAudio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&LockStatusAudio);
}

void Wt588fPlayNetworkQualityAudio(uint8_t Rssi)
{
  AudioFileTable_t NetworkQualityAudio = {0};

  NetworkQualityAudio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildNetworkQualityMessage(NetworkQualityAudio.FilePacket, &NetworkQualityAudio.SizeOfFile, Rssi);
  Wt588fStartVoicePaly(&NetworkQualityAudio);
}

void Wt588fPlayNormallyOpenStatueAudio(bool Status)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildConfigurationNormallyOpenModeMessage(Audio.FilePacket, &Audio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayInitiateDocumentReceiptAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildNotifyTheDeviceThatTheFileIsBeingDeliveredMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlaySystemLockAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildSystemLockMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLowBatteryAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLowBatteryMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayAddNewCardAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildAddNewCardMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayEnterKeyViaTheKeyboardAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildEnterKeyViaTheKeyboardMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLnvalidKeyValueAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildInvalidKeyValueMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayPasswordComparisonIsInconsistentAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildPasswordComparisonIsInconsistentMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayAuthenticationKeyInconsistencyAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildVerifyThatTheEnteredValuesAreConsistentMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayStartRegisterFaceEigenvaluesAudio(uint8_t WaitSecond)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildStartRegisterFaceEigenvaluesMessage(Audio.FilePacket, &Audio.SizeOfFile, WaitSecond);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLookMiddleAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLookMiddleMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLookUpAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLookUpMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLookDownAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLookDownMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayPlayLookLeftAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLookLeftMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLookRightAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLookRightMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayStartPrintingAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildStartPrintingMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayReadmissionPrintingAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildReadmissionPrintingMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayPleaseScanQrCodeAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildPleaseScanQrCodeMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayUserRegistrationStatusAudio(bool Status)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildUserRegistrationStatusMessage(Audio.FilePacket, &Audio.SizeOfFile, Status);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayExitLocalRegisterAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildExitLocalRegisterMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fExitPlayExitVerificationModeAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildExitVerificationModeMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayDeviceInTheInitializedState(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildIndicatesDeviceInTheInitializationStateMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayExpirationReminderAudio(uint8_t Day)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildExpirationReminderMessage(Audio.FilePacket, &Audio.SizeOfFile, Day);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayDeviceAuthorizationSuccessfulAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildDeviceAuthorizationSuccessfulMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayLicenseExpiredAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildLicenseExpiredMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayConnectTestAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildConnectTestMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlaySelfTestErrorMessage(uint8_t ErrorCode)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildSelfTestErrorMessage(Audio.FilePacket, &Audio.SizeOfFile, ErrorCode);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayUserAlreadyExistsAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildUserAlreadyExistsMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayVerifyAdminPasswordAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildVerifyAdminPasswordMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayExitRegisterMethodAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildExitRegisterMethodMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayVerifyUserPermissionsAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildPleaseVerifyUserPermissionsMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayDeviceLockedMessageAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildDeviceLockedMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayCardReplacedAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildCardReplacedMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayCardExpiredAudio(void)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildCardExpiredMessage(Audio.FilePacket, &Audio.SizeOfFile);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayRegisterUserCountAudio(uint8_t SuccessCount, uint8_t FailureCount)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildRegisterUserCountMessage(Audio.FilePacket, &Audio.SizeOfFile, SuccessCount, FailureCount);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fPlayRemainingBatteryPercentageAudio(uint8_t Percentage)
{
  AudioFileTable_t Audio = {0};

  Audio.TriggerTime = Wt588fGetSystemClockTime();
  Wt588fBuildRemainingBatteryPercentageMessage(Audio.FilePacket, &Audio.SizeOfFile, Percentage);
  Wt588fStartVoicePaly(&Audio);
}

void Wt588fIntoSleep(void)
{
  Wt588fDeleteAllAudioFile();
}

void Wt588fConfiguration(void)
{
  memset(&Wt588fStatusBit, 0, sizeof(Wt588fStatusBit_t));

  Wt588fExternalInterfaces_t ExternalInterfaces = {0};
  ExternalInterfaces.AudioPlaybackCallback = Wt588fPlayAudioTaskCallback;

  Wt588fInitialisingMessagequeue();
  Wt588fBoardInitialization(&ExternalInterfaces);
}

#endif
